// 文件位置: PersonalFinanceManager/src/main/java/FinanceRecord.java

import java.util.Date;

public class FinanceRecord {
    private Date date;
    private double amount;
    private String category;
    private String remark;

    public FinanceRecord(Date date, double amount, String category, String remark) {
        this.date = date;
        this.amount = amount;
        this.category = category;
        this.remark = remark;
    }

    // Getters and Setters
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public String toString() {
        return String.format("Date: %s, Amount: %.2f, Category: %s, Remark: %s", date, amount, category, remark);
    }
}
  
import java.util.ArrayList;  
import java.util.List;  
  
public class BillingService {  
  
    // 假设账单类  
    static class Bill {  
        private String id;  
        private double amount;  
        // 其他属性...  
  
        public Bill(String id, double amount) {  
            this.id = id;  
            this.amount = amount;  
        }  
  
        // getters and setters...  
    }  

  
    private List<Bill> bills = new ArrayList<>();  
  
    // 添加账单（用于测试）  
    public void addBill(Bill bill) {  
        bills.add(bill);  
    }  
  
    // 查看所有账单  
    public List<Bill> getAllBills() {  
        return new ArrayList<>(bills); // 返回副本，避免外部修改  
    }  
  
    // 查询账单  
    public Bill getBillById(String id) {  
        for (Bill bill : bills) {  
            if (bill.getId().equals(id)) {  
                return bill;  
            }  
        }  
        return null; // 如果没有找到，返回null  
    }  
  
    // 其他方法...  
}
